/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package syslivros;

import java.awt.Color;
import java.awt.event.KeyEvent;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Rafael
 */
public class Alterar_Entrega extends javax.swing.JFrame {

    /**
     * Creates new form Alterar_Entrega
     */
    public Alterar_Entrega() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        txtDataEnvio = new javax.swing.JFormattedTextField();
        lblDataEnvio = new javax.swing.JLabel();
        lblApostila = new javax.swing.JLabel();
        cbApostila = new javax.swing.JComboBox();
        lblCatis = new javax.swing.JLabel();
        cbCatis = new javax.swing.JComboBox();
        lblQauntidadeApostilas = new javax.swing.JLabel();
        txtQtdApostilas = new javax.swing.JTextField();
        lblProfessor = new javax.swing.JLabel();
        cbProfessor = new javax.swing.JComboBox();
        rdBtn_manha = new javax.swing.JRadioButton();
        rdBtn_Tarde = new javax.swing.JRadioButton();
        rdBtn_Noite = new javax.swing.JRadioButton();
        lblManha = new javax.swing.JLabel();
        lblTarde = new javax.swing.JLabel();
        lblNoite = new javax.swing.JLabel();
        lbl_periodo = new javax.swing.JLabel();
        btnAlterar = new javax.swing.JButton();
        btnVoltar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Alterar dados da Entrega de apostilas");

        try {
            txtDataEnvio.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        lblDataEnvio.setText("Data de envio: ");

        lblApostila.setText("Apostila: ");

        cbApostila.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione uma Apostila", ".NET Framework", "Java", "Linux", "Windows Server" }));

        lblCatis.setText("Catis: ");

        cbCatis.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione um Catis", "Centro Tecnológico (Sala 72)", "Centro Tecnológico (Sala 73)", "CECAP", "SETEC", "PROA", "Lúcio Martins", "Espaço da Juventude", "Sub Prefeitura (Lab. 1)", "Sub Prefeitura (Lab. 2)", "Saulo de Tarso" }));

        lblQauntidadeApostilas.setText("Quantidade de apostilas: ");

        lblProfessor.setText("Professor: ");

        cbProfessor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        rdBtn_manha.setText("M");

        rdBtn_Tarde.setText("T");

        rdBtn_Noite.setText("N");

        lblManha.setText("- Manhã");

        lblTarde.setText("-Tarde");

        lblNoite.setText("-Noite");

        lbl_periodo.setText("Periodo: ");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lblDataEnvio)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtDataEnvio, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lblApostila)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbApostila, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lblCatis)
                        .addGap(18, 18, 18)
                        .addComponent(cbCatis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lblQauntidadeApostilas)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtQtdApostilas, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lblProfessor)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbProfessor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(rdBtn_manha)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblManha)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(rdBtn_Tarde)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblTarde)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(rdBtn_Noite)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblNoite))
                    .addComponent(lbl_periodo))
                .addContainerGap(68, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblApostila)
                    .addComponent(cbApostila, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCatis)
                    .addComponent(cbCatis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblQauntidadeApostilas)
                    .addComponent(txtQtdApostilas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDataEnvio)
                    .addComponent(txtDataEnvio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                .addComponent(lbl_periodo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblManha)
                        .addComponent(lblTarde)
                        .addComponent(rdBtn_Noite)
                        .addComponent(lblNoite)
                        .addComponent(rdBtn_manha))
                    .addComponent(rdBtn_Tarde, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblProfessor, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cbProfessor, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        btnAlterar.setText("Alterar");
        btnAlterar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAlterarActionPerformed(evt);
            }
        });
        btnAlterar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                btnAlterarKeyPressed(evt);
            }
        });

        btnVoltar.setText("Voltar");
        btnVoltar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnVoltarActionPerformed(evt);
            }
        });
        btnVoltar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                btnVoltarKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnAlterar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 254, Short.MAX_VALUE)
                        .addComponent(btnVoltar)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnVoltar)
                    .addComponent(btnAlterar))
                .addContainerGap())
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-416)/2, (screenSize.height-338)/2, 416, 338);
    }// </editor-fold>//GEN-END:initComponents

    private void btnAlterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarActionPerformed
        //faça tbm que se gere um protocolo de recebimento da apostila
        int apostilasTotal;
        int qtApostilas_Atual = 0;
        String _char;

        if(!cbApostila.getSelectedItem().equals("Selecione uma Apostila")&&(!cbCatis.getSelectedItem().equals("Selecione um Catis"))
            &&!txtQtdApostilas.getText().equals("") && !txtQtdApostilas.getText().equals("0")&&!txtDataEnvio.getText().equals("  /  /    ")){

            try{
                int qtdApostila=Integer.valueOf(txtQtdApostilas.getText());
                char periodo;
                if(rdBtn_Noite.isSelected()){
                    periodo='N';
                }else if(rdBtn_Tarde.isSelected()){
                    periodo='T';
                }else{
                    periodo='M';
                }
                System.out.println(periodo);
                String curso = (String) cbApostila.getSelectedItem();
                String catis = (String) cbCatis.getSelectedItem();

                switch (curso) {
                    case ".NET":

                   
                          
                    try {
                    PreparedStatement      p = Conexao.ConexaoJDBC.prepareStatement( "select * from estoque_base  where qt_Dotnet >=0 " );
                   

                        ResultSet rs=p.executeQuery();
                        while(rs.next()){

                            qtApostilas_Atual =rs.getInt("qt_Dotnet");

                        } apostilasTotal=qtApostilas_Atual-qtdApostila;

                        PreparedStatement ps = Conexao.ConexaoJDBC.prepareStatement("update estoque_base set qt_WindowsServer = ?");

                        ps.setInt(1, apostilasTotal);
                        ps.setDate(2,/*Data*/null);              //ajustar

                        ps.execute();
                        PreparedStatement psinsert =Conexao.ConexaoJDBC.prepareStatement("insert into estoque_curso values(?,?,?,?,?,?)");
                        psinsert.setString(1, null);
                        psinsert.setString(2, curso);

                        psinsert.setString(3, _char= String.valueOf(periodo));
                        psinsert.setInt(4, qtdApostila);
                        psinsert.setString(5,catis);
                        psinsert.setDate(6,null);
                        psinsert.execute();
                        
                         PreparedStatement ps_InsertHistorico=Conexao.ConexaoJDBC.prepareStatement("insert into historico_curso values(?,?,?,?,?)");
                         ps_InsertHistorico.setString(1, null);
                         ps_InsertHistorico.setString(2, curso);
                        ps_InsertHistorico.setString(3, _char=String.valueOf(periodo));
                        ps_InsertHistorico.setInt(4, qtdApostila);
                        ps_InsertHistorico.setString(5, catis);
                        ps.setDate(6, null);
                        ps_InsertHistorico.execute();
                        
                        JOptionPane.showMessageDialog(this, "Atualização feita com sucesso","Entrega de apostilas",JOptionPane.INFORMATION_MESSAGE);
                        new Apostilas().setVisible(true);
                        this.dispose();

                    } catch (Exception ex) {

                    } break;

                    case "Java":
                    try {
                        PreparedStatement p = Conexao.ConexaoJDBC.prepareStatement( "select * from estoque_base  where qt_Java >=0 " );
                        ResultSet rs=p.executeQuery();
                        while(rs.next()){

                            qtApostilas_Atual =rs.getInt("qt_Java");

                        }apostilasTotal=qtApostilas_Atual-qtdApostila;
                        PreparedStatement ps = Conexao.ConexaoJDBC.prepareStatement("update estoque_base set qt_Java = ?");

                        ps.setInt(1, apostilasTotal);

                        // ps.setDate(2,/*data*/null);    //ajustar

                        ps.execute();
                        PreparedStatement psinsert =Conexao.ConexaoJDBC.prepareStatement("insert into estoque_curso values(?,?,?,?,?,?)");
                        psinsert.setString(1, null);
                        psinsert.setString(2, curso);

                        psinsert.setString(3, _char= String.valueOf(periodo));
                        psinsert.setInt(4, qtdApostila);
                        psinsert.setString(5,catis);
                        psinsert.setDate(6,null);
                        psinsert.execute();
                         PreparedStatement ps_InsertHistorico=Conexao.ConexaoJDBC.prepareStatement("insert into historico_curso values(?,?,?,?,?)");
                         ps_InsertHistorico.setString(1, null);
                         ps_InsertHistorico.setString(2, curso);
                        ps_InsertHistorico.setString(3, _char=String.valueOf(periodo));
                        ps_InsertHistorico.setInt(4, qtdApostila);
                        ps_InsertHistorico.setString(5, catis);
                        ps.setDate(6, null);
                        ps_InsertHistorico.execute();

                        JOptionPane.showMessageDialog(this, "Autualizado com sucesso", "Entrega", JOptionPane.INFORMATION_MESSAGE);
                        new Principal().setVisible(true);
                        this.dispose();
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(this, "Erro ao inserir dados!"+ex.getMessage(),"ERRO",JOptionPane.ERROR_MESSAGE);

                    }   break;
                    case "Linux":
                    try {
                        PreparedStatement p;
                        p = Conexao.ConexaoJDBC.prepareStatement( "select * from estoque_base  where qt_Linux >=0 " );
                        ResultSet rs=p.executeQuery();
                        while(rs.next()){

                            qtApostilas_Atual =rs.getInt("qt_Linux");

                        }apostilasTotal=qtApostilas_Atual-qtdApostila;
                        PreparedStatement ps = Conexao.ConexaoJDBC.prepareStatement("update estoque_base set qt_Linux = ?");

                        ps.setInt(1,apostilasTotal );

                        // ps.setDate(6,/*data*/null);                  //ajustar

                        ps.execute();
                        PreparedStatement psinsert =Conexao.ConexaoJDBC.prepareStatement("insert into estoque_curso values(?,?,?,?,?,?)");
                        psinsert.setString(1, null);
                        psinsert.setString(2, curso);

                        psinsert.setString(3, _char= String.valueOf(periodo));
                        psinsert.setInt(4, qtdApostila);
                        psinsert.setString(5,catis);
                        psinsert.setDate(6,null);
                        psinsert.execute();
                          PreparedStatement ps_InsertHistorico=Conexao.ConexaoJDBC.prepareStatement("insert into historico_curso values(?,?,?,?,?)");
                         ps_InsertHistorico.setString(1, null);
                         ps_InsertHistorico.setString(2, curso);
                        ps_InsertHistorico.setString(3, _char=String.valueOf(periodo));
                        ps_InsertHistorico.setInt(4, qtdApostila);
                        ps_InsertHistorico.setString(5, catis);
                        ps.setDate(6, null);
                        ps_InsertHistorico.execute();

                        JOptionPane.showMessageDialog(this, "Autualizado com sucesso", "Entrega", JOptionPane.INFORMATION_MESSAGE);
                        new Principal().setVisible(true);
                        this.dispose();
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(this, "Erro ao inserir dados!"+ex.getMessage(),"ERRO",JOptionPane.ERROR_MESSAGE);

                    }   break;
                    case "Windows Server": //seguir o modelo  abaixo!!!!
                    try {
                        PreparedStatement p = Conexao.ConexaoJDBC.prepareStatement( "select * from estoque_base  where qt_WindowsServer >=0 " );
                        ResultSet rs=p.executeQuery();
                        while(rs.next()){

                            qtApostilas_Atual =rs.getInt("qt_WindowsServer");

                        } apostilasTotal=qtApostilas_Atual-qtdApostila;
                        PreparedStatement ps = Conexao.ConexaoJDBC.prepareStatement("update estoque_base set qt_WindowsServer = ?");

                        ps.setInt(1, apostilasTotal);                  //ajustar
                        // ps.setDate(6,/*data*/null);

                        ps.execute();
                        PreparedStatement psinsert =Conexao.ConexaoJDBC.prepareStatement("insert into estoque_curso values(?,?,?,?,?,?)");
                        psinsert.setString(1, null);
                        psinsert.setString(2, curso);

                        psinsert.setString(3, _char= String.valueOf(periodo));
                        psinsert.setInt(4,qtdApostila);
                        psinsert.setString(5,catis);
                        psinsert.setDate(6,null);
                        psinsert.execute();
                        
                         PreparedStatement ps_InsertHistorico=Conexao.ConexaoJDBC.prepareStatement("insert into historico_curso values(?,?,?,?,?)");
                         ps_InsertHistorico.setString(1, null);
                         ps_InsertHistorico.setString(2, curso);
                        ps_InsertHistorico.setString(3, _char=String.valueOf(periodo));
                        ps_InsertHistorico.setInt(4, qtdApostila);
                        ps_InsertHistorico.setString(5, catis);
                        ps.setDate(6, null);
                        ps_InsertHistorico.execute();

                        JOptionPane.showMessageDialog(this, "Autualizado com sucesso", "Entrega", JOptionPane.INFORMATION_MESSAGE);
                        new Principal().setVisible(true);
                        this.dispose();
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(this, "Erro ao inserir dados!"+ex.getMessage(),"ERRO",JOptionPane.ERROR_MESSAGE);

                    }   break;}

                }
                catch(  NumberFormatException ex){
                    lblQauntidadeApostilas.setForeground(Color.red);
                    JOptionPane.showMessageDialog(this,"Digite apenas números inteiros"+ ex.getMessage(),"ERRO",JOptionPane.ERROR_MESSAGE);

                }

            } else{ if(!rdBtn_Noite.isSelected()&&!rdBtn_Tarde.isSelected()&&!rdBtn_manha.isSelected()){

                JOptionPane.showMessageDialog(this,"Selecione um período!","ERRO",JOptionPane.ERROR_MESSAGE);
                lbl_periodo.setForeground(Color.red);
            }else{
                lbl_periodo.setForeground(Color.black);
            }

            if(cbApostila.getSelectedItem().equals("Selecione uma Apostila")) {
                JOptionPane.showMessageDialog(this, "Preencha todos os campos \"Apostila\"", "Erro", JOptionPane.ERROR_MESSAGE);
                lblApostila.setForeground(Color.red);
            } else {
                lblApostila.setForeground(Color.black);
            }
            if (cbCatis.getSelectedItem().equals("Selecione um Catis")) {
                JOptionPane.showMessageDialog(this, "Preencha todos os campos \"Catis\"", "Erro", JOptionPane.ERROR_MESSAGE);
                lblCatis.setForeground(Color.red);
            } else {
                lblCatis.setForeground(Color.black);
            }
            if (txtQtdApostilas.getText().equals("") || txtQtdApostilas.getText().equals("0")) {
                JOptionPane.showMessageDialog(this, "Preencha todos os campos \"Quantidade de Apostilas\"   ", "Erro", JOptionPane.ERROR_MESSAGE);
                lblQauntidadeApostilas.setForeground(Color.red);
            } else {
                lblQauntidadeApostilas.setForeground(Color.black);
            }

            if (txtDataEnvio.getText().equals("  /  /    ")) {
                JOptionPane.showMessageDialog(this, "Preencha todos os campos \"Data de envio\" ", "Erro", JOptionPane.ERROR_MESSAGE);
                lblDataEnvio.setForeground(Color.red);
            } else { lblDataEnvio.setForeground(Color.black);}
           

        }
    }//GEN-LAST:event_btnAlterarActionPerformed

    private void btnAlterarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btnAlterarKeyPressed
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            btnAlterarActionPerformed(null);   }
    }//GEN-LAST:event_btnAlterarKeyPressed

    private void btnVoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVoltarActionPerformed
        new Apostilas().setVisible(true);
        this.dispose();
    }//GEN-LAST:event_btnVoltarActionPerformed

    private void btnVoltarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btnVoltarKeyPressed
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            btnVoltarActionPerformed(null);
        }
    }//GEN-LAST:event_btnVoltarKeyPressed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Alterar_Entrega.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Alterar_Entrega.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Alterar_Entrega.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Alterar_Entrega.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Alterar_Entrega().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAlterar;
    private javax.swing.JButton btnVoltar;
    private javax.swing.JComboBox cbApostila;
    private javax.swing.JComboBox cbCatis;
    private javax.swing.JComboBox cbProfessor;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel lblApostila;
    private javax.swing.JLabel lblCatis;
    private javax.swing.JLabel lblDataEnvio;
    private javax.swing.JLabel lblManha;
    private javax.swing.JLabel lblNoite;
    private javax.swing.JLabel lblProfessor;
    private javax.swing.JLabel lblQauntidadeApostilas;
    private javax.swing.JLabel lblTarde;
    private javax.swing.JLabel lbl_periodo;
    private javax.swing.JRadioButton rdBtn_Noite;
    private javax.swing.JRadioButton rdBtn_Tarde;
    private javax.swing.JRadioButton rdBtn_manha;
    private javax.swing.JFormattedTextField txtDataEnvio;
    private javax.swing.JTextField txtQtdApostilas;
    // End of variables declaration//GEN-END:variables
}
